package com.siki.www.clock.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

import java.time.LocalDate;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;

/**
 * keyvonchen
 */
@ApiModel("统计信息详细VO")
@Getter
@Setter
@ToString
@NoArgsConstructor
public class CountMsgDetailVO {
    @ApiModelProperty("日期")
    String date;

    @ApiModelProperty("当日打卡人数")
    Long clockCount;

    @ApiModelProperty("尚未打卡人数")
    Long unClockCount;

    @ApiModelProperty("异常人数")
    Long errorCount;

    public CountMsgDetailVO(Map<String, Object> map) {
        Optional.ofNullable(map).ifPresent(m -> {
            this.date = m.get("clock_date").toString();
            this.clockCount = (Long) m.get("clock_count");
            this.errorCount = (Long) m.get("error_count");
        });
    }
}
